package com.example.onion.hxchat.adapter;

import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;
import androidx.fragment.app.FragmentStatePagerAdapter;

import java.util.List;
/**
 * 适配器，你们应该不用用到我的适配器不多写了吧
 */
public class MyPagerAdapter extends FragmentStatePagerAdapter {
    private List<Fragment> fragmentList = null;
    private List<String> titleList = null;

    public MyPagerAdapter(@NonNull FragmentManager fm, int behavior,  List<Fragment> fragmentList) {
        super(fm, behavior);
        this.fragmentList =fragmentList;
    }

//    public MyPagerAdapter(@NonNull FragmentManager fm, List<Fragment> fragmentList, List<String> titleList) {
//        super(fm);
//        this.fragmentList = fragmentList;
//        this.titleList = titleList;
//    }
//
//    public MyPagerAdapter(@NonNull FragmentManager fm, List<Fragment> fragmentList) {
//        super(fm);
//        this.fragmentList = fragmentList;
//    }

    @Override
    public int getCount() {
        if (fragmentList != null) {
            return fragmentList.size();
        }
        return 0;
    }


    @NonNull
    @Override
    public Fragment getItem(int position) {
        return fragmentList.get(position);
    }


    @Override
    public CharSequence getPageTitle(int position) {
        return titleList.get(position);
    }
}



